home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December (Special) / PCWorld_2005-12_Special_cd.bin / Internet / prohlizec / prohlizec.exe / WinSweep3.exe / {app} / no-ads.pac < prev    next >
Text File  |  2004-01-31  |  34KB  |  1,072 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // John's No-ADS proxy auto configuration script
  4. //    http://www.schooner.com/~loverso/no-ads/
  5. //    loverso@schooner.com
  6. //    Questions/help web forum at http://www.network54.com/Hide/Forum/223428
  7. //
  8. // Copyright 1996-2003, John LoVerso.  All Rights Reserved.
  9. //
  10. //    Permission is given to use and distribute this file, as long as this
  11. //    copyright message and author notice are not removed.
  12. //
  13. //    No responsibility is taken for any errors on inaccuracies inherent
  14. //    either to the comments or the code of this program, but if reported
  15. //    to me, then an attempt will be made to fix them.
  16. //
  17. // ("no monies exchanged" in Copyright clause removed 11/2001)
  18. //
  19. // $Id: no-ads.pac,v 5.18 2003/12/19 17:48:12 loverso Exp loverso $
  20. //
  21.  
  22. // ****
  23. // **** If you do not use a proxy to access the Internet, then the following
  24. // **** line is already fine.
  25. // ****
  26. // **** If you use an a proxy to access the Internet, as required by your
  27. // **** ISP or or firewall, then change the line below, replacing
  28. // **** "DIRECT" with "PROXY hostname:port", using the correct hostname:port
  29. // **** for your proxy server.
  30. // ****
  31. var normal = "DIRECT";
  32.  
  33. // ***
  34. // *** Update the next line with the correct hostname:port
  35. // *** of your blackhole proxy server, if needed.
  36. // ***
  37. // *** (If you use IE, this is already fine)
  38. // ***
  39. var blackhole = "PROXY localhost:3421";
  40.  
  41. ///////////////////////////////////////////////////////////////////////////////
  42. //
  43. // This simple kludge uses a mechanism built into most browsers (IE,
  44. // Netscape, and Mozilla) on most platforms to block connections to
  45. // banner ad servers.
  46. //
  47. // This mechanism uses the "proxy auto configuration" to blackhole requests
  48. // to load ad images without forcing all your traffic through an ad-blocking
  49. // proxy server.  Of course, unlike ad-blocking proxy servers, this does not
  50. // otherwise not strip cookies.
  51. //
  52. // "Proxy auto configuration" invokes the JavaScript FindProxyForURL function
  53. // below each time your browser requests a URL.  This works even if you have
  54. // JavaScript otherwise disabled in your browser!  (Which you should!)
  55. //
  56.  
  57. //
  58. // Send me your additions or comments.  I'll credit you in the file.
  59. // (But I've removed all email addresses to stop spam harvesters).
  60. //
  61.  
  62.  
  63. ///////////////////////////////////////////////////////////////////////////////
  64. //
  65. // These are the basic steps needed to use "no-ads.pac".
  66. // Detailed instructions follow below!
  67. //
  68. // 1. Save this as a file (no-ads.pac) on your local disk
  69. //    (or, add it to your home page, if you have one)
  70. // 2. Select a no-ads "blackhole".
  71. // 3. Configure your browser to use this file as it's auto proxy configuration.
  72. // 4. Clear your browser's cache
  73. //    (or else it may still show you ads it has saved on your disk).
  74. //
  75.  
  76.  
  77. ///////////////////////////////////////////////////////////////////////////////
  78. //
  79. // 1. SAVE THIS FILE
  80. //
  81. // Copy this file to your local machine; use your home directory (UNIX)
  82. // or your Desktop or C:\ directory (Windows).
  83. //
  84.  
  85.  
  86.  
  87. ///////////////////////////////////////////////////////////////////////////////
  88. //
  89. // 2. SELECT A NO-ADS BLACKHOLE
  90. //
  91. // If you are using any version of Internet Explorer, you are all set.
  92. // Skip this step.  You can also skip this version for Mozilla 1.4 and
  93. // Netscape 7.1 (they include PAC failover support).
  94. //
  95. //
  96. // The basic trick of no-ads is to match the site or URL of annoying web content
  97. // and tell your browser to use a proxy that will deny loading of that resource
  98. // (image, page, etc).
  99. //
  100. // A "black-hole" proxy server is one that always denies loading a web page.
  101. // ("send it off to a blackhole").
  102. //
  103. // When you initially get "no-ads.pac", it is using this as the blackhole:
  104. //
  105. //    "PROXY localhost:3421"
  106. //
  107. // This says to use the local host at a port which nothing should be listening
  108. // on.  Thus, this is "a server that doesn't repond."
  109. //
  110. //
  111. // Some possibilities for the blackhole:
  112. //
  113. //    a. A server that doesn't respond.
  114. //
  115. //        *** This works for all versions of Internet Explorer.
  116. //        *** This mostly works for Mozilla 1.4 and Netscape 7.1.
  117. //
  118. //        If you do nothing, then this is configured to direct annoying
  119. //        content to the proxy running on your localhost at port 3421.
  120. //        Since you shouldn't have anything running on that port, that
  121. //        connection will timeout and the annoying content will never be
  122. //        loaded.
  123. //
  124. //        Older versions of Netscape wait to connect to the proxy server
  125. //        (usually it needs to load part of the image to layout the web
  126. //        page), and then asks if you want to disable the proxy that
  127. //        doesn't answer.
  128. //
  129. //        Older versions of Mozilla will given alert saying it couldn't
  130. //        connect to the proxy server.
  131. //
  132. //        Mozilla 1.4 and Netscape 7.1 will only give you this alert if
  133. //        the page being display is blocked, rather than just an image
  134. //        on that page.  Thus, I still recommend a blackhole proxy even
  135. //        though it isn't needed.
  136. //
  137. //        Opera will disable your auto proxy config if the proxy server
  138. //        doesn't respond.
  139. //
  140. //        IE doesn't care that the proxy server isn't responding.  As
  141. //        this avoids a connection for annoying content, it is fastest.
  142. //
  143. //    b. A simple, blackhole server
  144. //
  145. //        When needed, I run a simple "server" at port 3421 that denies
  146. //        all requests.  Some options you can use for this:
  147. //
  148. //        - On Windows, you can try Larry Wang's black-hole proxy program:
  149. //
  150. //            http://leisuresuit10.tripod.com/BlackHoleProxy/
  151. //
  152. //          I can not vouch that his binaries are virus free, but he does
  153. //          offer the source code.
  154. //
  155. //        - I use this shell script on UNIX; it is invoked via inetd.
  156. //          /usr/local/lib/noproxy:
  157. //
  158. //            #!/bin/sh
  159. //            read a
  160. //            read b
  161. //            echo HTTP/1.0 501 No Ads Accepted
  162. //            echo ""
  163. //            exit
  164. //
  165. //          Add this line to inetd.conf ('kill -HUP' inetd afterwards):
  166. //
  167. //            3421 stream tcp nowait nobody /usr/local/lib/noproxy noproxy
  168. //
  169. //          This simple script doesn't work on Linux because of the
  170. //          (IMHO) broken way it's TCP stack works.  See the bottom of
  171. //          http://www.schooner.com/~loverso/no-ads/ for a complete copy
  172. //          of the `noproxy' shell script.
  173. //
  174. //          If always exec'ing a shell was expensive on your computer
  175. //          (it isn't on mine), then you could use a "wait"-style Perl
  176. //          script that would accept() incoming connections.
  177. //
  178. //        - Sean Burke has a black-hole proxy written in Perl script:
  179. //
  180. //          http://www.speech.cs.cmu.edu/~sburke/pub/black_hole_http_server.pl
  181. //          (This is a standalone server, not run from inetd).
  182. //
  183. //    e. A trick: use an HTTP/1.0 non-proxy server
  184. //
  185. //        An HTTP/1.0 non-proxy server will return a 501 error when
  186. //        given a proxy request.  Thus, just use the address of your
  187. //        local intranet web server as your blackhole PROXY.
  188. //        The downside of this is that it will probably also log an
  189. //        error, which wastes a small amount of resources.
  190. //
  191. //    ***
  192. //    *** Be sure to update the "blackhole" variable above with a setting of
  193. //    *** "PROXY hostname:port" that matches your blackhole server!!
  194. //    ***
  195. //
  196. //    ***
  197. //    *** If you already use a proxy server to access the WWW,
  198. //    *** change the "normal" variable above from "DIRECT" to
  199. //    *** be "PROXY proxy:port" to match your proxy server.
  200. //    ***
  201.  
  202.  
  203. ///////////////////////////////////////////////////////////////////////////////
  204. //
  205. // 3. TO CONFIGURE YOUR BROWSER
  206. //
  207. // The Proxy Auto Configuration file can be either on the local disk or
  208. // accessed from a web server, with the following constraints:
  209. //
  210. //    a. IE4 can only load the PAC from a web server (http:// URL)
  211. //    b. Netscape, Mozilla, and IE 5 can load the PAC from anywhere.
  212. //    c. Netscape and Mozilla (and probably Opera) require the correct
  213. //       MIME type when loading the PAC from a web server.
  214. //
  215. //
  216. // To set the Proxy Auto Configuration with Netscape Navigator or Mozilla:
  217. //
  218. //   1. Enable Proxy Auto Config:
  219. //
  220. //    Open "Edit->Preferences"
  221. //    Select "Advanced"
  222. //    Select "Proxies"
  223. //    Select "Auto proxy configuration" option
  224. //    Enter URL or path of this file
  225. //
  226. //        http://yourserver/no-ads.pac
  227. //
  228. //    If you place this on your local disk, you should use a
  229. //    file: URL such as:
  230. //
  231. //        file:/home/loverso/no-ads.pac            (UNIX)
  232. //        file://c:/windows/desktop/no-ads.pac        (Windows)
  233. //
  234. //   2. If you are serving this from a web server, Netscape Navigator requires
  235. //      correct MIME type on the file before using it.  You must configure
  236. //      your web server to provide a "application/x-ns-proxy-autoconfig"
  237. //    MIME type.
  238. //
  239. //      a. For Apache, name the file with a ".pac" extension and add this
  240. //       line to the http.conf (or the .htaccess file in the same directory):
  241. //
  242. //        AddType application/x-ns-proxy-autoconfig .pac
  243. //
  244. //      b. For IIS (instructions from Kevin Roth)
  245. //
  246. //       Open Internet Services Manager
  247. //       Right click on the web site (or directory) you wish to change.
  248. //       Choose Properties
  249. //       Click the "HTTP Headers" tab
  250. //       Click the "File Types" button in the "MIME Map" section
  251. //       Click the "New Type..." button
  252. //       Enter "pac" for "Associated Extension"
  253. //       Enter "application/x-ns-proxy-autoconfig" for "Content Type (MIME)"
  254. //       Click OK to close the Add type dialog, the MIME types dialog,
  255. //        and the main properties dialog.
  256. //
  257. //      (This is definately needed for NS, but not for IE)
  258. //
  259. //
  260. // To set the Proxy Auto Configuration with IE:
  261. //
  262. //   1. Enable Proxy Auto Config:
  263. //
  264. //    Open "Tools->Internet Options"
  265. //    Select "Connections" tab
  266. //    Click "LAN Settings"
  267. //        or Choose an entry from "Dial-up settings" and click "Settings"
  268. //
  269. //    On the settings dialog, select "Use automatic configuration script"
  270. //    Enter the URL of this file in Address field.
  271. //
  272. //        http://yourserver/no-ads.pac
  273. //        file://c:/windows/desktop/no-ads.pac        (Windows)
  274. //
  275. //    You can only use a file: URL with IE5 (or later).
  276. //    (I have tested using "file:" with 5.0sp2/Win98 and 5.5sp2/Win2k).
  277. //
  278. //   2. Fix Security Settings (IMPORTANT):
  279. //
  280. //    Select "Security" tab
  281. //    Select "Local intranet"
  282. //    Click "Sites" box
  283. //    Unselect "include all sites that bypass the proxy server" option
  284. //
  285. //   3. Disable "Auto Proxy Caching" (IMPORTANT):
  286. //      (thanks to Kevin Roth for alerting me of this!)
  287. //
  288. //    IE contains a proxy result caching mechanism that will defeat the
  289. //    ability to block servers that server both ad and non-ad content.
  290. //    To prevent this, add the registry key described in this MS KB article:
  291. //
  292. //        http://support.microsoft.com/?kbid=271361
  293. //
  294. //    You can do so by downloading this file and clicking on it to load
  295. //    it into the registry.  This must be done on a per-user basis.
  296. //    http://www.schooner.com/~loverso/no-ads/IE-no-auto-proxy-cache.reg
  297. //
  298. //   IE doesn't currently check the MIME type of the PAC file.
  299. //
  300. //   To see some notes from MS on PAC in IE, see
  301. //    http://msdn.microsoft.com/library/periodic/period99/faq0599.htm
  302. //    (they seem to have removed this URL)
  303. //
  304. //
  305. // To set the Proxy Auto Configuration with Opera 6 (6.04 on Windows tested):
  306. //
  307. //   1. Enable Proxy Auto Config:
  308. //    Open the Preferences (Alt-P)
  309. //    Select "Network"
  310. //    Click the "Proxy servers" box
  311. //    Select "Use automatic proxy configuration"
  312. //    Enter the URL of this file as
  313. //
  314. //        http://yourserver/no-ads.pac
  315. //        file://c:/windows/desktop/no-ads.pac
  316. //
  317. //   2. You must use a blackhole proxy for Opera (it will not work with an
  318. //    address of a server that does not respond).
  319. //
  320. //   3. Be sure to clear the cache and exit/restart Opera.
  321. //
  322.  
  323.  
  324. ///////////////////////////////////////////////////////////////////////////////
  325. //
  326. // 4. CLEAR YOUR BROWSER'S CACHE
  327. //
  328. // For Internet Explorer:
  329. //
  330. //    Open "Tools->Internet Options"
  331. //    Select "Delete Files" under "Temporary Internet Files"
  332. //    Click "OK"
  333. //
  334. // For Mozilla/Netscape Navigator:
  335. //
  336. //    Open "Edit->Preferences"
  337. //    Select "Advanced"
  338. //    Select "Proxies"
  339. //    Click "Clear Disk Cache"
  340. //    Click "Clear Memory Cache"
  341. //
  342. // For Opera:
  343. //
  344. //    Open "File->Preferences"
  345. //    Select "History and cache"
  346. //    Click "Empty now"
  347. //
  348.  
  349.  
  350. ///////////////////////////////////////////////////////////////////////////////
  351. //
  352. // To see the definition of this page's JavaScript contents, see
  353. //
  354. //    http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
  355. //
  356. // Microsoft includes this in thie KB article:
  357. //    http://support.microsoft.com/support/kb/articles/Q209/2/66.ASP
  358. //
  359. // Special PAC functions:
  360. // Hostname:
  361. //    isPlainHostName(host)
  362. //    dnsDomainIs(host, domain)
  363. //    localHostOrDomainIs(host, hostdom)
  364. //    isResolvable(host)
  365. //    isInNet(host, pattern, mask)
  366. // Utility:
  367. //    dnsResolve(host)
  368. //    myIpAddress()
  369. //    dnsDomainLevels(host)
  370. // URL:
  371. //    shExpMatch(str, shexp)
  372. // Time:
  373. //    weekdayRange(wd1, wd2, gmt)
  374. //    dateRange(...)
  375. //    timeRange(...)
  376. //
  377. // Other functions and methods that may work:
  378. //    http://developer.netscape.com/docs/manuals/communicator/jsref/win1.htm
  379. //    Note that "alert()" only works with Netscape4 and IE.
  380. //
  381.  
  382. ///////////////////////////////////////////////////////////////////////////////
  383. //
  384. // Regular Expressions
  385. //
  386. // Angus Turnbull pointed out the JavaScript 1.2 RE operators to me.
  387. // These should work in NS4 and IE4 (or later), but I have only tested on
  388. // Mozilla (1.3), IE5.5, and IE6.  PLEASE TELL ME IF IT WORKS FOR YOU!
  389. //
  390. // A good introduction is at:
  391. //    http://www.evolt.org/article/Regular_Expressions_in_JavaScript/17/36435/
  392. // Some references:
  393. //    http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/regexp.html
  394. //    http://developer.netscape.com/docs/manuals/js/client/jsref/regexp.htm
  395. //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsobjRegExpression.asp
  396. //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsgrpRegExpSyntax.asp
  397. //
  398. // I'm slowly replacing multiple glob patterns with regexps.
  399. // By using RE literals of /.../ rather than the constructor 'new RegExp()',
  400. // the regexps should be compiled as no-ads.pac is loaded.
  401. // 
  402. // Important notes:
  403. // -    if using the constructor, \ needs to be quoted; thus "\\." is used
  404. //    to match a literal '.'.  In the RE literal form, I need to end up
  405. //    quoting any / for a URL path.
  406. // -    Avoid these for now; they are broken or not supported in "older"
  407. //    browsers such as NS4 and IE4:
  408. //    - look-aheads (?=pat)
  409. //    - non-greedy ? - a ? that follows *,+,?, and {}; (s)? is NOT non-greedy
  410. //
  411.  
  412. // matches several common URL paths for ad images:
  413. // such as: /banner/ /..._banner/ /banner_...
  414. // but matches several words and includes plurals
  415. var re_banner = /\/(.*_){0,1}(ad|adfarm|adimage|adframe|banner|popup|popunder)(s)?(_|\/)/i;
  416.  
  417. // matches host names staring with: ad, ad1, ads03, etc
  418. // or anything hostname starting with "pop", "clicks", and "cash"
  419. var re_adxxx = /^(ad(s)?.{0,4}\.|pop.*|click.*|cash.*)/i;
  420.  
  421. ///////////////////////////////////////////////////////////////////////////////
  422.  
  423. var isActive = 1;
  424.  
  425. function FindProxyForURL(url, host)
  426. {
  427.     // debug
  428.     // alert("checking: " + url);
  429.  
  430.     // Excellent kludge from Sean M. Burke:
  431.     // Enable or disable no-ads for the current browser session.
  432.     //
  433.     // To disable, visit this URL:        http://no-ads.int/off
  434.     // To re-enable, visit this URL:        http://no-ads.int/on
  435.     //
  436.     // (this will not work with Mozilla or Opera if the alert()s are present)
  437.     //
  438.     // This happens before lowercasing the URL, so make sure you use lowercase!
  439.     //
  440.     if (shExpMatch(host, "no-ads.int")) {
  441.         if (shExpMatch(url, "*/on*")) {
  442.         isActive = 1;
  443.         // alert("no-ads is enabled.\n" + url);
  444.     } else if (shExpMatch(url, "*/off*")) {
  445.         isActive = 0;
  446.         // alert("no-ads has been disabled.\n" + url);
  447.     } else {
  448.         // alert("no-ads unknown option.\n" + url);
  449.     }
  450.  
  451.     return blackhole;
  452.     }
  453.  
  454.     if (!isActive) {
  455.     return normal;
  456.     }
  457.  
  458.     // Suggestion from Quinten Martens
  459.     // Make everything lower case.
  460.     // WARNING: all shExpMatch rules following MUST be lowercase!
  461.     url = url.toLowerCase();
  462.     host = host.toLowerCase();
  463.  
  464.     //
  465.     // Whitelist section from InvisiBill
  466.     //
  467.     // Add sites here that should never be matched for ads.
  468.     //
  469.     if (0
  470.         // To add whitelist domains, simple add a line such as:
  471.       //    || dnsDomainIs(host, "schooner.com")
  472.     // or for a single host
  473.     //    || isInNet(host, "192.168.0.1", "255.255.255.255")
  474.  
  475.     // Note: whitelisting schooner.com will defeat the "is-it-working"
  476.     // test page at http://www.schooner.com/~loverso/no-ads/ads/
  477.  
  478.     // Apple.com "Switch" ads
  479.     || shExpMatch(url, "*.apple.com/switch/ads/*")
  480.  
  481.     // SprintPCS
  482.     || dnsDomainIs(host, ".sprintpcs.com")
  483.  
  484.     ) {
  485.     return normal;
  486.     }
  487.  
  488.     // To add more sites, simply include them in the correct format.
  489.     //
  490.     // The sites below are ones I currently block.  Tell me of others you add!
  491.  
  492.     if (0
  493.     // Block IE4/5 "favicon.ico" fetches
  494.     // (to avoid being tracked as having bookmarked the site)
  495.     || shExpMatch(url, "*/favicon.ico")
  496.  
  497.     //////
  498.     //
  499.     // Global Section
  500.     // tries to match common names
  501.     //
  502.  
  503.     // RE for common URL paths (replaces block of shExpmatch below)
  504.     || re_banner.test(url)
  505.  
  506.     // This section targets most command "ad" URLs.  These try to avoid
  507.     // the problems with a rule of this form:
  508.     //     || shExpMatch(url, "*ads*")
  509.     // (in that it will disallow all URLs that say "downloads")
  510.  
  511.     // This removes all hostnames starting with "ad????."
  512.     // (matches things like ad., ads., ads03., etc), but not others
  513.     // (such as add.yahoo.com)  Modified with suggestion from Kevin Roth.
  514.  
  515.     // (replaces shExpMatch's below)
  516.     || (re_adxxx.test(host)
  517.         && !(
  518.             shExpMatch(host, "add*")
  519.          || shExpMatch(host, "admin*")
  520.        )
  521.     )
  522.  
  523.     // Match hostnames
  524.     || shExpMatch(host, "*banner*")
  525.     || shExpMatch(host, "*adserv*")
  526.  
  527.     || shExpMatch(host, "*62.26.220.5*")    // Falk Ad-Solutions
  528.     || shExpMatch(host, "*falkag*")
  529.     || shExpMatch(host, "*.ivwbox.*")
  530.     || shExpMatch(host, "*.tfag.*")
  531.     || shExpMatch(url, "*falkag*")
  532.     || shExpMatch(url, "*adsclick*")
  533.     || shExpMatch(url, "*phpads*")
  534.     || shExpMatch(url, "*adfarm*")
  535.  
  536.  
  537.     // or any subdomain "ads"
  538.     || (dnsDomainLevels(host) > 2 && shExpMatch(host, "*.ads.*"))
  539.  
  540.     //////
  541.     //
  542.     // banner/ad organizations
  543.     // Just delete the entire namespace
  544.     //
  545.  
  546.     // these set cookies
  547.     || dnsDomainIs(host, ".doubleclick.com")
  548.         || dnsDomainIs(host, ".doubleclick.net")
  549.     || dnsDomainIs(host, ".globaltrack.com")
  550.     || dnsDomainIs(host, ".burstnet.com")
  551.     || dnsDomainIs(host, ".adbureau.net")
  552.     || dnsDomainIs(host, ".targetnet.com")
  553.     || dnsDomainIs(host, ".humanclick.com")
  554.     || dnsDomainIs(host, ".linkexchange.com")
  555.  
  556.     || dnsDomainIs(host, ".fastclick.com")
  557.     || dnsDomainIs(host, ".fastclick.net")
  558.         // one whole class C full of ad servers (fastclick)
  559.         || isInNet(host, "205.180.85.0", "255.255.255.0")
  560.  
  561.     // these use 1x1 images to track you
  562.     || dnsDomainIs(host, ".admonitor.com")
  563.     || dnsDomainIs(host, ".focalink.com")
  564.  
  565.     || dnsDomainIs(host, ".websponsors.com")
  566.     || dnsDomainIs(host, ".commission-junction.com")
  567.     || dnsDomainIs(host, ".advertising.com")
  568.     || dnsDomainIs(host, ".cybereps.com")
  569.     || dnsDomainIs(host, ".postmasterdirect.com")
  570.     || dnsDomainIs(host, ".advertising.com")
  571.     || dnsDomainIs(host, ".mediaplex.com")
  572.     || dnsDomainIs(host, ".adtegrity.com")
  573.     || dnsDomainIs(host, ".bannerbank.ru")
  574.     || dnsDomainIs(host, ".bannerspace.com")
  575.     || dnsDomainIs(host, ".theadstop.com")
  576.     || dnsDomainIs(host, ".l90.com")
  577.     || dnsDomainIs(host, ".webconnect.net")
  578.     || dnsDomainIs(host, ".avenuea.com")
  579.     || dnsDomainIs(host, ".flycast.com")
  580.     || dnsDomainIs(host, ".engage.com")
  581.     || dnsDomainIs(host, ".imgis.com")
  582.     || dnsDomainIs(host, ".datais.com")
  583.     || dnsDomainIs(host, ".link4ads.com")
  584.     || dnsDomainIs(host, ".247media.com")
  585.     || dnsDomainIs(host, ".hightrafficads.com")
  586.     || dnsDomainIs(host, ".qkimg.net")
  587.     || dnsDomainIs(host, ".tribalfusion.com")
  588.     || dnsDomainIs(host, ".rightserve.net")
  589.     || dnsDomainIs(host, ".admaximize.com")
  590.     || dnsDomainIs(host, ".valueclick.com")
  591.     || dnsDomainIs(host, ".adlibris.se")
  592.     || dnsDomainIs(host, ".vibrantmedia.com")
  593.     || dnsDomainIs(host, ".coremetrics.com")
  594.     || dnsDomainIs(host, ".vx2.cc")
  595.     || dnsDomainIs(host, ".webpower.com")
  596.     || dnsDomainIs(host, ".everyone.net")
  597.     || dnsDomainIs(host, ".zedo.com")
  598.     || dnsDomainIs(host, ".bigbangmedia.com")
  599.     || dnsDomainIs(host, ".ad-annex.com")
  600.     || dnsDomainIs(host, ".iwdirect.com")
  601.     || dnsDomainIs(host, ".adlink.de")
  602.     || dnsDomainIs(host, ".bidclix.net")
  603.     || dnsDomainIs(host, ".webclients.net")
  604.     || dnsDomainIs(host, ".linkcounter.com")
  605.     || dnsDomainIs(host, ".sitetracker.com")
  606.     || dnsDomainIs(host, ".adtrix.com")
  607.     || dnsDomainIs(host, ".netshelter.net")
  608.     || dnsDomainIs(host, ".rn11.com")
  609.     // http://vpdc.ru4.com/content/images/66/011.gif
  610.     || dnsDomainIs(host, ".ru4.com")
  611.  
  612.     // */adv/*
  613.     || dnsDomainIs(host, ".bluestreak.com")
  614.  
  615.     // Virtumundo -- as annoying as they get
  616.     || dnsDomainIs(host, ".virtumundo.com")
  617.     || dnsDomainIs(host, ".treeloot.com")
  618.     || dnsDomainIs(host, ".memberprize.com")
  619.  
  620.     // internetfuel and _some_ of the sites they redirect to
  621.     // (more internetfuel - from Sam G)
  622.     || dnsDomainIs(host, ".internetfuel.net")
  623.     || dnsDomainIs(host, ".internetfuel.com")
  624.     || dnsDomainIs(host, ".peoplecaster.com")
  625.     || dnsDomainIs(host, ".cupidsdatabase.com")
  626.     || dnsDomainIs(host, ".automotive-times.com")
  627.     || dnsDomainIs(host, ".healthy-lifetimes.com")
  628.     || dnsDomainIs(host, ".us-world-business.com")
  629.     || dnsDomainIs(host, ".internet-2-web.com")
  630.     || dnsDomainIs(host, ".my-job-careers.com")
  631.     || dnsDomainIs(host, ".freeonline.com")
  632.     || dnsDomainIs(host, ".exitfuel.com")
  633.     || dnsDomainIs(host, ".netbroadcaster.com")
  634.     || dnsDomainIs(host, ".spaceports.com")
  635.     || dnsDomainIs(host, ".mircx.com")
  636.     || dnsDomainIs(host, ".exitchat.com")
  637.     || dnsDomainIs(host, ".atdmt.com")
  638.     || dnsDomainIs(host, ".partner2profit.com")
  639.     || dnsDomainIs(host, ".centrport.net")
  640.     || dnsDomainIs(host, ".centrport.com")
  641.     // http://ads.rampidads.com/rampidads/showad.php?p=2&t=1
  642.     // || dnsDomainIs(host, ".rampidads.com")
  643.  
  644.     //////
  645.     //
  646.     // banner servers
  647.     // (typically these set cookies or serve animated ads)
  648.     //
  649.  
  650.     || dnsDomainIs(host, "commonwealth.riddler.com")
  651.     || dnsDomainIs(host, "banner.freeservers.com")
  652.     || dnsDomainIs(host, "usads.futurenet.com")
  653.     || dnsDomainIs(host, "banners.egroups.com")
  654.     || dnsDomainIs(host, "ngadclient.hearme.com")
  655.     || dnsDomainIs(host, "affiliates.allposters.com")
  656.     || dnsDomainIs(host, "adincl.go2net.com")
  657.     || dnsDomainIs(host, "webads.bizservers.com")
  658.  
  659.     // marketwatch.com (flash ads)
  660.     || dnsDomainIs(host, "a.mktw.net")
  661.     
  662.     // "undergroundonline"
  663.     // comes from iframe with this url: http://mediamgr.ugo.com/html.ng/size=728x90&affiliate=megagames&channel=games&subchannel=pc&Network=affiliates&rating=g
  664.     || dnsDomainIs(host, "image.ugo.com")
  665.     || dnsDomainIs(host, "mediamgr.ugo.com")
  666.  
  667.     // web ads and "cheap Long Distance"
  668.     || dnsDomainIs(host, "zonecms.com")
  669.     || dnsDomainIs(host, "zoneld.com")
  670.  
  671.     // AOL
  672.     || dnsDomainIs(host, ".atwola.com")
  673.     || dnsDomainIs(host, "toolbar.aol.com")
  674.  
  675.     //////
  676.     //
  677.     // popups/unders
  678.     //
  679.  
  680.     || dnsDomainIs(host, "remotead.cnet.com")
  681.     || dnsDomainIs(host, ".1st-dating.com")
  682.     || dnsDomainIs(host, ".mousebucks.com")
  683.     || dnsDomainIs(host, ".yourfreedvds.com")
  684.     || dnsDomainIs(host, ".popupsavings.com")
  685.     || dnsDomainIs(host, ".popupmoney.com")
  686.     || dnsDomainIs(host, ".popuptraffic.com")
  687.     || dnsDomainIs(host, ".popupnation.com")
  688.     || dnsDomainIs(host, ".infostart.com")
  689.     || dnsDomainIs(host, ".popupad.net")
  690.     || dnsDomainIs(host, ".usapromotravel.com")
  691.     || dnsDomainIs(host, ".goclick.com")
  692.     || dnsDomainIs(host, ".trafficwave.net")
  693.     || dnsDomainIs(host, ".popupad.net")
  694.     || dnsDomainIs(host, ".paypopup.com")
  695.  
  696.     // Popups from ezboard
  697.     || dnsDomainIs(host, ".greenreaper.com")
  698.     || dnsDomainIs(host, ".spewey.com")
  699.     || dnsDomainIs(host, ".englishharbour.com")
  700.     || dnsDomainIs(host, ".casino-trade.com")
  701.     || dnsDomainIs(host, "got2goshop.com")
  702.     // more ezboard crud (from Miika Asunta)
  703.     || dnsDomainIs(host, ".addynamix.com")
  704.     || dnsDomainIs(host, ".trafficmp.com")
  705.     || dnsDomainIs(host, ".makingmoneyfromhome.net")
  706.     || dnsDomainIs(host, ".leadcart.com")
  707.  
  708.     // http://www.power-mark.com/js/popunder.js
  709.     || dnsDomainIs(host, ".power-mark.com")
  710.  
  711.     //////
  712.     //
  713.     // User tracking (worse than ads) && hit counting "services"
  714.     //
  715.  
  716.     // "web trends live"
  717.     || dnsDomainIs(host, "webtrendslive.com")
  718.     || dnsDomainIs(host, ".wtlive.com")
  719.  
  720.     // 1x1 tracking images
  721.     || dnsDomainIs(host, "service.bfast.com")
  722.  
  723.     // one whole class C full of ad servers
  724.     || isInNet(host, "66.40.16.0", "255.255.255.0")
  725.  
  726.     || dnsDomainIs(host, ".web-stat.com")
  727.     || dnsDomainIs(host, ".superstats.com")
  728.     || dnsDomainIs(host, ".allhits.ru")
  729.     || dnsDomainIs(host, ".list.ru")
  730.     || dnsDomainIs(host, ".counted.com")
  731.     || dnsDomainIs(host, ".rankyou.com")
  732.     || dnsDomainIs(host, ".clickcash.com")
  733.     || dnsDomainIs(host, ".clickbank.com")
  734.     || dnsDomainIs(host, ".paycounter.com")
  735.     || dnsDomainIs(host, ".cashcount.com")
  736.     || dnsDomainIs(host, ".clickedyclick.com")
  737.     || dnsDomainIs(host, ".clickxchange.com")
  738.     || dnsDomainIs(host, ".sitestats.com")
  739.     || dnsDomainIs(host, ".site-stats.com")
  740.     || dnsDomainIs(host, ".hitbox.com")
  741.     || dnsDomainIs(host, ".exitdirect.com")
  742.     || dnsDomainIs(host, ".realtracker.com")
  743.     || dnsDomainIs(host, ".etracking.com")
  744.     || dnsDomainIs(host, ".livestat.com")
  745.     || dnsDomainIs(host, ".spylog.com")
  746.     || dnsDomainIs(host, ".freestats.com")
  747.     || dnsDomainIs(host, ".addfreestats.com")
  748.     || dnsDomainIs(host, ".topclicks.net")
  749.     || dnsDomainIs(host, ".mystat.pl")
  750.     || dnsDomainIs(host, ".hitz4you.de")
  751.  
  752.     // clickability, via CNN
  753.     || dnsDomainIs(host, ".clickability.com")
  754.     || dnsDomainIs(host, ".savethis.com")
  755.  
  756.     //////
  757.     //
  758.     // Spyware/worms
  759.     //
  760.  
  761.     || dnsDomainIs(host, ".friendgreetings.com")
  762.     || dnsDomainIs(host, ".permissionedmedia.com")
  763.     || dnsDomainIs(host, ".searchbarcash.com")
  764.  
  765.     //////
  766.     //
  767.     // "Surveys"
  768.     //
  769.  
  770.     || dnsDomainIs(host, ".zoomerang.com")
  771.  
  772.     //////
  773.     //
  774.     // "Casino" ads (scams)
  775.     //
  776.  
  777.     || dnsDomainIs(host, ".aceshigh.com")
  778.     || dnsDomainIs(host, ".idealcasino.net")
  779.     || dnsDomainIs(host, ".casinobar.net")
  780.     || dnsDomainIs(host, ".casinoionair.com")
  781.  
  782.     || (dnsDomainIs(host, ".go2net.com")
  783.         && shExpMatch(url, "*adclick*")
  784.     )
  785.  
  786.     //////
  787.     //
  788.     // Spammers
  789.     //
  790.  
  791.     || dnsDomainIs(host, ".Licensed-Collectibles.com")
  792.     || dnsDomainIs(host, ".WebDesignProfessional.com")
  793.  
  794.     //////
  795.     //
  796.     // Directed at extra annoying places
  797.     //
  798.  
  799.     // Attempts to download ad-supported spyware without asking first
  800.     || dnsDomainIs(host, ".gator.com")
  801.  
  802.     // ebay
  803.     || (dnsDomainIs(host, "pics.ebay.com")
  804.         && shExpMatch(url, "*/pics/mops/*/*[0-9]x[0-9]*")
  805.     )
  806.  
  807.     // Bravenet & Ezboard
  808.     || (dnsDomainIs(host, ".ezboard.com")
  809.         && shExpMatch(url, "*/bravenet/*")
  810.     )
  811.     || (dnsDomainIs(host, ".bravenet.com")
  812.         && (   shExpMatch(host, "*counter*")
  813.         || shExpMatch(url, "*/jsbanner*")
  814.         )
  815.     )
  816.  
  817.     // GeoCities
  818.     // (checking "toto" from Prakash Persaud)
  819.     || ((   dnsDomainIs(host,"geo.yahoo.com")
  820.          || dnsDomainIs(host,".geocities.com"))
  821.         && (
  822.            shExpMatch(url,"*/toto?s*")
  823.         || shExpMatch(url, "*geocities.com/js_source*")
  824.         || dnsDomainIs(host, "visit.geocities.com")
  825.         )
  826.     )
  827.  
  828.     // Yahoo ads (direct and via Akamai)
  829.     // http://us.a1.yimg.com/us.yimg.com/a/...
  830.     || (dnsDomainIs(host,"yimg.com")
  831.         && (   shExpMatch(url,"*yimg.com/a/*")
  832.         || shExpMatch(url,"*yimg.com/*/adv/*")
  833.         )
  834.     )
  835.     // "eyewonder" ads at Yahoo
  836.     || dnsDomainIs(host,"qz3.net")
  837.     // background ad images
  838.     || dnsDomainIs(host,"buzzcity.com")
  839.  
  840.     // FortuneCity - ads and tracking
  841.     || (dnsDomainIs(host,".fortunecity.com")
  842.         && (    shExpMatch(url,"*/js/adscript*")
  843.          || shExpMatch(url,"*/js/fctrack*")
  844.         )
  845.     )
  846.  
  847.     // zdnet
  848.     || (dnsDomainIs(host, ".zdnet.com")
  849.         && (   dnsDomainIs(host, "ads3.zdnet.com")
  850.         || shExpMatch(url, "*/texis/cs/ad.html")
  851.         || shExpMatch(url, "*/adverts")
  852.          )
  853.     )
  854.  
  855.     // nytimes
  856.     || (dnsDomainIs(host, ".nytimes.com")
  857.         && shExpMatch(url,"*/adx/*")
  858.     )
  859.  
  860.     // Be Free affiliate ads
  861.     || dnsDomainIs(host, ".reporting.net")
  862.     || dnsDomainIs(host, ".affliate.net")
  863.     || (dnsDomainIs(host, ".akamai.net")
  864.         && shExpMatch(url, "*.affiliate.net/*")
  865.     )
  866.  
  867.     // Infospace.com popunder
  868.     // for "webmarket.com" & "shopping.dogpile.com" -- just say no!
  869.     || (dnsDomainIs(host, ".infospace.com")
  870.         && shExpMatch(url, "*/goshopping/*")
  871.     )
  872.     || dnsDomainIs(host, ".webmarket.com")
  873.     || dnsDomainIs(host, "shopping.dogpile.com")
  874.  
  875.     // goto.com popunder for information.gopher.com
  876.     || dnsDomainIs(host, "information.gopher.com")
  877.  
  878.     // About.com popunder
  879.     || (dnsDomainIs(host, ".about.com")
  880.         && shExpMatch(url, "*/sprinks/*")
  881.     )
  882.  
  883.     // Dell
  884.     || (dnsDomainIs(host, ".dell.com")
  885.         && shExpMatch(url, "*/images/affiliates/*")
  886.     )
  887.  
  888.     // IFilm iframes
  889.     || (dnsDomainIs(host, ".ifilm.com")
  890.         && (shExpMatch(url, "*/partners/*")
  891.             || shExpMatch(url, "*/redirect*")
  892.         )
  893.     )
  894.  
  895.     // tomshardware
  896.     // they are most annoying:
  897.     // - cookies on their background images to track you
  898.     // - looping shockwave ads
  899.     // this kills most of the crud
  900.     || ((dnsDomainIs(host, ".tomshardware.com")
  901.          || isInNet(host, "216.92.21.0", "255.255.255.0"))
  902.         && (   shExpMatch(url, "*/cgi-bin/banner*")
  903.             || shExpMatch(url, "*/cgi-bin/bd.m*")
  904.             || shExpMatch(url, "*/images/banner/*")
  905.         )
  906.     )
  907.  
  908.     || shExpMatch(url, "*mapsonus.com/ad.images*")
  909.  
  910.     // Slashdot: added these when I saw hidden 1x1 images with cookies
  911.     || dnsDomainIs(host, "adfu.blockstackers.com")
  912.     || (dnsDomainIs(host, "slashdot.org")
  913.         && (
  914.                shExpMatch(url, "*/slashdot/pc.gif*")
  915.         || shExpMatch(url, "*/pagecount.gif*")
  916.         || shExpMatch(url, "*/adlog.pl*")
  917.         )
  918.         )
  919.     || dnsDomainIs(host, "googlesyndication.com")
  920.  
  921.     // it-aint-cool.com
  922.     || (dnsDomainIs(host, "aintitcool.com")
  923.         && (
  924.                shExpMatch(url, "*/newline/*")
  925.         || shExpMatch(url, "*/drillteammedia/*")
  926.         || shExpMatch(url, "*/foxsearchlight/*")
  927.         || shExpMatch(url, "*/media/aol*")
  928.         || shExpMatch(url, "*swf")
  929.         )
  930.     )
  931.  
  932.     // OfficeMax affiliate art (affArt->affart because of toLowerCase)
  933.     || (dnsDomainIs(host, ".officemax.com")
  934.         && shExpMatch(url, "*/affart/*")
  935.     )
  936.  
  937.     // complicated JavaScript for directed ads!
  938.     || (dnsDomainIs(host, ".anandtech.com")
  939.         && (shExpMatch(url,"*/js/*")
  940.             || shExpMatch(url,"*/bnr_*")
  941.         )
  942.     )
  943.  
  944.     // cnet ads
  945.     || dnsDomainIs(host, "promo.search.com")
  946.  
  947.     // IMDB celeb photos
  948.     // (Photos/CMSIcons->photos/cmsicons because of toLowerCase)
  949.     || (dnsDomainIs(host, "imdb.com")
  950.         && (   shExpMatch(url, "*/photos/cmsicons/*")
  951.             || shExpMatch(url, "*/icons/*/celeb/*")
  952.         )
  953.     )
  954.  
  955.     //////
  956.     //
  957.     // "Other Scum And Villainry"
  958.     //
  959.  
  960.     // Popup from "reserved" domains at register.com
  961.     // (I considered blocking all of register.com)
  962.     || (dnsDomainIs(host, ".register.com")
  963.         && (shExpMatch(url,"*.js")
  964.         || shExpMatch(host, "searchtheweb*")
  965.         || shExpMatch(host, "futuresite*")
  966.         )
  967.     )
  968.  
  969.     || dnsDomainIs(host, ".oingo.com")
  970.     || dnsDomainIs(host, ".namingsolutions.com")
  971.  
  972.     // "Data collection"
  973.     || dnsDomainIs(host, ".coremetrics.com")
  974.  
  975.     // Sets your home page
  976.     || dnsDomainIs(host, ".firehunt.com")
  977.  
  978.     // tracking
  979.     || dnsDomainIs(host, ".appliedsemantics.com")
  980.  
  981.     // Scum who buy ad space from the above
  982.     // || dnsDomainIs(host, ".hartfordrents.com")
  983.     // || dnsDomainIs(host, ".chicagocomputerrentals.com")
  984.     // || dnsDomainIs(host, ".ccrsolutions.com")
  985.     // || dnsDomainIs(host, ".rushcomputer.com")
  986.     // || dnsDomainIs(host, ".localesimates.com")
  987.     // || dnsDomainIs(host, ".unitedvision.com")
  988.     || isInNet(host, "216.216.246.31", "255.255.255.255")
  989.  
  990.     // avsforum ads
  991.     || isInNet(host, "216.66.21.35", "255.255.255.255")
  992.  
  993.     // bogus "search" sites at non-existent sites
  994.     || dnsDomainIs(host, ".search411.com")
  995.  
  996.     // palmgear.com
  997.     || (dnsDomainIs(host, ".palmgear.com")
  998.         && (   shExpMatch(url, "*/adsales/*")
  999.         || shExpMatch(url, "*/emailblast*")
  1000.         )
  1001.     )
  1002.  
  1003.     //////
  1004.     //
  1005.     // Contributed adult sites
  1006.     //
  1007.  
  1008.     || dnsDomainIs(host, ".porntrack.com")
  1009.     || dnsDomainIs(host, ".sexe-portail.com")
  1010.     || dnsDomainIs(host, ".sextracker.com")
  1011.     || dnsDomainIs(host, ".sexspy.com")
  1012.     || dnsDomainIs(host, ".offshoreclicks.com")
  1013.     || dnsDomainIs(host, ".exxxit.com")
  1014.  
  1015.     // debug
  1016.     // || (alertmatch("NOT:" + url) && 0)
  1017.  
  1018.     ) {
  1019.  
  1020.     // alert("blackholing: " + url);
  1021.  
  1022.     // deny this request
  1023.     return blackhole;
  1024.  
  1025.     } else {
  1026.     // debug
  1027.     // alert("allowing: " + url);
  1028.  
  1029.     // all other requests go direct and avoid any overhead
  1030.     return normal;
  1031.     }
  1032. }
  1033.  
  1034. ///////////////////////////////////////////////////////////////////////////////
  1035. //
  1036. // This line is just for testing; you can ignore it.  But, if you are having
  1037. // problems where you think this PAC file isn't being loaded, then change this
  1038. // to read "if (1)" and the alert box should appear when the browser loads this
  1039. // file.
  1040. //
  1041. // This works for IE4, IE5, IE5.5, IE6 and Netscape 2.x, 3.x, and 4.x.
  1042. // This does not work for Mozilla (and probably not for Netscape 6.x).
  1043. // (For IE6, tested on Win2K)
  1044. //
  1045. if (0) {
  1046.     alert("autoconfig notice: LOADED");
  1047. }
  1048.  
  1049. // The above should show you that this JavaScript is executed in an
  1050. // unprotected global context.  NEVER point at someone elses autoconfig file;
  1051. // always load from your own copy!
  1052.  
  1053. // an alert that returns true
  1054. function alertmatch(url)
  1055. {
  1056.     alert("match: "+url);
  1057.     return 1;
  1058. }
  1059.  
  1060.  
  1061. ///////////////////////////////////////////////////////////////////////////////
  1062. //
  1063. // Tired of reading boring comments?  Try reading today's comics:
  1064. //    http://www.schooner.com/~loverso/comics/
  1065. //
  1066. // or getting a quote from my collection:
  1067. //    http://www.schooner.com/~loverso/quote/
  1068. //
  1069.  
  1070. // eof
  1071.  
  1072.